//
//  NetHandler.h
//  iMoney
//
//  Created by Sean McGrail on 2/10/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>


@protocol NetHandlerDelegate <NSObject>
@optional
- (void) progress: (NSString*) message;
- (void) error: (NSString*) message;
- (void) done;
@end


@interface NetHandler : NSObject {

	id delegate;
	
	NSInputStream* inStream;
	NSOutputStream* outStream;
	
	CFWriteStreamRef writeStream;
	CFReadStreamRef readStream;

	BOOL firstRead;
 	uint32_t numBytes;
	uint32_t totalBytesRead;
	
	NSMutableData* mainData;
	
}


@property(assign) id<NetHandlerDelegate> delegate;

- (id) initWithNetService: (NSNetService*) netService: (id<NetHandlerDelegate>) netDelegate;
- (void) openStreams;
- (void) closeStreams;
- (void) sendXML:(const NSString*) message;

@end
